import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'json'
})
export class JsonPipe implements PipeTransform {

  transform(value: any, args): any {
      if( args === 'label' ){
         return JSON.parse(value).label;
      } else if( args === 'value' ){
          return JSON.parse(value).value;
      }
    return null;
  }

}
